package com.ghsc.ghxc.jsb.ui.message.adapter

import android.widget.LinearLayout
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.cn.appcore.ext.getCompatColor
import com.cn.appcore.utils.GlideUtil
import com.flyco.roundview.RoundLinearLayout
import com.ghsc.ghxc.jsb.R
import com.ghsc.ghxc.jsb.ui.message.bean.GroupTypeItem

/**
 * 项目：GuoHuaJsb
 * 包名：com.ghsc.ghxc.jsb.ui.message.adapter
 * 类名：GroupTypeAdapter
 * 创建时间：2024/5/9 19:25
 * 创建人 @author： xiaolin
 * 描述 ：Todo...
 */
class GroupTypeAdapter  : BaseQuickAdapter<GroupTypeItem, BaseViewHolder>(
    R.layout.group_type_item) {

    override fun convert(helper: BaseViewHolder, item: GroupTypeItem) {
        GlideUtil.ImageLoad(this.context, if(item.isSelect) item.checked_icon else item.un_checked_icon, helper.getView(R.id.icon))
        helper.setText(R.id.title,item.title)
            .setTextColor(R.id.title,if(item.isSelect) this.context.getCompatColor( R.color.white) else this.context.getCompatColor( R.color.font_black))


        var llItemAll =helper.getView<LinearLayout>(R.id.llItemALl)
        var llItem =helper.getView<RoundLinearLayout>(R.id.llItem)

        if (item.isSelect){
            llItemAll.setBackgroundResource(R.drawable.im_s_bg)
            llItem.delegate.backgroundColor=0
        }else{
            llItemAll.setBackgroundResource(0)
            llItem.delegate.backgroundColor=this.context.getCompatColor( R.color.F6F6F6)
        }


//       helper.getView<RoundLinearLayout>(R.id.llItem).delegate.backgroundColor=if (item.isSelect) this.context.getCompatColor( R.color.main_color) else this.context.getCompatColor( R.color.F6F6F6)

    }
}
